package com.yongheng.controller;

import com.yongheng.service.UserService;
import com.yongheng.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {
    @Autowired
    private UserService userService;

    // localhost/user
    @GetMapping("/user")
    public String findUserName() {
        User user = userService.getById(1);
        return user.getName();
    }
}
